package com.example.shirodemo.service.impl;

import com.example.shirodemo.pojo.SysUser;
import com.example.shirodemo.repository.SysUserRepository;
import com.example.shirodemo.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

@Service
public class SysUserServiceImpl extends SysUserService {
    @Autowired
    private SysUserRepository sysUserRepository;
    //保存
    public void save(SysUser sysUser){
        sysUserRepository.save(sysUser);
    }
    //分页操作
    public Page<SysUser> pageByAdminUser(Integer page, Integer size){
        PageRequest pageRequest=PageRequest.of(page,size, Sort.Direction.ASC,"id");
        return sysUserRepository.findAll(pageRequest);
    }

}
